/*
 *  This file is part of WWWPal.
 *
 *  Copyright (C) 2003  Dr. John Punin, Department of Computer Science
 *  Rensselaer Polytechnic Institute
 *
 *  WWWPal is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  WWWPal is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef GR_WRITE_LOGML_H
#define GR_WRITE_LOGML_H

#define XML_VERSION_STRING "<?xml version=\"1.0\"?>\n"
#define DOCTYPE_STRING "<!DOCTYPE logml SYSTEM \"http://www.cs.rpi.edu/~puninj/LOGML/logml.dtd\">\n"
#define LOGML_GENERATOR "<!-- LOGML File Generated by webloggr 1.0 -->\n"

FILE *
assert_open_xml_file(const char *name_file);

void
GR_write_xml_head_logml_file(FILE *fp);

void
GR_write_head_logml_file(FILE *fp,char *start_date, char *end_date);

void
GR_write_end_logml_file(FILE *fp);

void
GR_write_start_graph_logml_file(FILE *fp);

void
GR_write_end_graph_logml_file(FILE *fp);

void
GR_write_start_node_logml_file(FILE *fp,int nid,char *slabel,int nhits,int isindp,int ehits);

void
GR_write_end_node_logml_file(FILE *fp);

void
GR_write_node_att_logml_file(FILE *fp,char *aname, char *avalue);

void
GR_write_empty_edge_logml_file(FILE *fp,int sid,int tid,char *elabel,int hits,int isindp);

void
GR_write_start_edge_logml_file(FILE *fp,int sid,int tid,char *elabel,int hits,int isindp);

void
GR_write_end_edge_logml_file(FILE *fp);

void
GR_write_att_edge_logml_file(FILE *fp,char *satt);

void
GR_write_start_hosts_logml_file(FILE *fp, int count);

void
GR_write_end_hosts_logml_file(FILE *fp);

void
GR_write_host_logml_file(FILE *fp,char *name,char *ip,long acount,long bytes,
			 long npages,int is_internal);

void
GR_write_start_domains_logml_file(FILE *fp, int count);

void
GR_write_end_domains_logml_file(FILE *fp);

void
GR_write_domain_logml_file(FILE *fp,char *name,long acount, char *sbytes,
			   long npages );

void
GR_write_start_directories_logml_file(FILE *fp, int count);

void
GR_write_end_directories_logml_file(FILE *fp);

void
GR_write_directory_logml_file(FILE *fp,char *name,long acount,long tcount, 
			      long bytes);

void
GR_write_start_user_agents_logml_file(FILE *fp, int count);

void
GR_write_end_user_agents_logml_file(FILE *fp);

void
GR_write_user_agent_logml_file(FILE *fp,char *name,long acount,double bytes,
			       long npages);

void
GR_write_start_host_referers_logml_file(FILE *fp, int count);

void
GR_write_end_host_referers_logml_file(FILE *fp);

void
GR_write_host_referer_logml_file(FILE *fp,char *name,long acount,long bytes,
				 int isse);
void
GR_write_start_referers_logml_file(FILE *fp, int count);

void
GR_write_end_referers_logml_file(FILE *fp);

void
GR_write_referer_logml_file(FILE *fp,char *name,long acount,long bytes,
			    int isinternal,int target,int http_code);

void
GR_write_start_keywords_logml_file(FILE *fp, int count,char *search_engine_name, long search_count);

void
GR_write_end_keywords_logml_file(FILE *fp);

void
GR_write_keyword_logml_file(FILE *fp,char *name,int acount);

void
GR_write_start_summary_logml_file(FILE *fp,
			    long requests, long sessions,long bytes, 
			    long html_pages, long nhtml_pages, 
			    long inline_objects, long hyperlink_html, 
			    long hyperlink_nhtml, long html_entry_pages,
			    long nhtml_entry_pages, long unique_sites,
			    long unique_host_referers,long unique_se_referers,
			    long unique_external_url_referers,
			    long unique_internal_url_referers,
			    long unique_user_agents,
			    double requests_hour, double requests_day,
			    double kbytes_day, double kbytes_hour, 
				  long searches, long unique_keywords);

void
GR_write_end_summary_logml_file(FILE *fp);

void
GR_write_http_code_logml_file(FILE *fp,int code,char *name,long acount,
			      double bytes, long npages);

void
GR_write_http_method_logml_file(FILE *fp,char *name,long acount,
				double bytes, long npages);

void
GR_write_http_version_logml_file(FILE *fp,char *name,long acount,
				 double bytes, long npages);

void
GR_write_start_date_stat_logml_file(FILE *fp);

void
GR_write_end_date_stat_logml_file(FILE *fp);

void
GR_write_month_stat_logml_file(FILE *fp,int month,long hits,long bytes,
			  long html_pages);

void
GR_write_day_stat_logml_file(FILE *fp,int day,long hits,long bytes,
			long html_pages);

void
GR_write_hour_stat_logml_file(FILE *fp,int hour,long hits,long bytes,
			 long html_pages);


void
GR_write_empty_uedge_logml_file(FILE *fp,int sid,int tid,char *t);

void
GR_write_start_path_logml_file(FILE *fp,int count);

void
GR_write_end_path_logml_file(FILE *fp);

void
GR_write_start_user_session_logml_file(FILE *fp,char *name,char *epage,
				       char *referer,char *stime,long acount);

void
GR_write_end_user_session_logml_file(FILE *fp);

void
GR_write_start_user_sessions_logml_file(FILE *fp,int n, int max_edges,
					int min_edges);

void
GR_write_end_user_sessions_logml_file(FILE *fp);

#endif


